<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    const PER_PAGE = 15;//分页常量
    //处理分页数据
    public function executePage($request)
    {
        $page = $request->page ?? 1;
        $per_page = $request->per_page ?? self::PER_PAGE;
        return [
            'page' => $page,
            'per_page' => $per_page,
            'offset' => ($page-1)*$per_page,
        ];
    }
}
